export default {
  mode: "spa",
  //页面头部信息，也可单独在页面里配置
  head: {
    title: process.env.npm_package_name || "",
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      {
        hid: "description",
        name: "description",
        content: process.env.npm_package_description || ""
      }
    ],
    link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }]
  },
  //页面加载进度条
  loading: "~/components/loading",
  // 自定义404页面
  router: {
    extendRoutes (routes, resolve) {
      routes.push({
        name: 'custom',
        path: '*',
        component: resolve(__dirname, 'pages/404.vue')
      })
    }
  },
  //全局css
  css: [
    "element-ui/lib/theme-chalk/index.css", //element
    "./assets/css/reset.css", //reset
    "./assets/css/icon.css", //icon
    "./assets/css/public.scss" //common
  ],
  //开始前需要加载的库
  plugins: [
    "~/plugins/element-ui",
    "~/plugins/router",
    "~/plugins/main"
  ],
  modules: [
    "@nuxtjs/style-resources", //全局可以使用css变量
    "@nuxtjs/axios",//axios
    "@nuxtjs/proxy"//代理
  ],
  //代理
  proxy: [
    [
      "/api",
      {
        target: "http://zays.gakm.net", // api主机
        pathRewrite: { '^/api' : '/' }
      }
    ]
  ],
  // 其他任何地方都可以引用此处变量的scss
  styleResources: {
    scss: "./assets/css/variable-mixin.scss" //mixin
  },
  build: {
    transpile: [/^element-ui/],
    extend(config, ctx) {}
  }
};
